<?xml version="1.0" ?>
<!-- XML Schema file for verifying Web Configuration file of Bing Web Error PHP Toolkit -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:complexType name="stringArrayType">
    <xs:annotation>
      <xs:documentation>This is a representation of an array of mixed values.</xs:documentation>
    </xs:annotation>
    <xs:sequence minOccurs="0" maxOccurs="unbounded">
      <xs:element name="string" type="xs:string" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="valueType">
    <xs:annotation>
      <xs:documentation>This is a representation of value of a mixed single type.</xs:documentation>
    </xs:annotation>
    <xs:choice>
      <xs:element name="boolean" type="xs:boolean" nillable="true" />
      <xs:element name="integer" type="integerRealNillable" />
      <xs:element name="string" type="xs:string" nillable="true" />
      <xs:element name="stringArray" type="stringArrayType" nillable="true" />
      <xs:element name="enumEnableDisable" type="enumEnableDisable" />
      <xs:element name="enumAllExcludeInclude" type="enumAllExcludeInclude" />
      <xs:element name="BingAppID" type="patternBingAppID" minOccurs="1" maxOccurs="1" />
      <xs:element name="ISOLangCountry" type="patternIsoLanguageCountry" />
      <xs:element name="DomainArray" type="domainArrayType" />
      <xs:element name="BingApiVersion" type="xs:decimal" minOccurs="0" maxOccurs="1" />
      <xs:element name="UrlPath" type="patternUrlPath" />
      <xs:element name="BingWebCount" type="integerBingWebCount" maxOccurs="1" minOccurs="0" />
    </xs:choice>
  </xs:complexType>
 
  <xs:complexType name="settingType">
    <xs:annotation>
      <xs:documentation>This is a representation of a web page setting which is a tuple of attribute:name and element:value.</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="value" type="valueType"/>
    </xs:sequence>
    <xs:attribute name="name" type="xs:string"/>
  </xs:complexType>
 
  <xs:complexType name="applicationSettingsType"> 
    <xs:annotation>
      <xs:documentation>This is a representation of all the settings for a web page.</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="setting" type="settingType" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
 </xs:complexType>
 
  <xs:element name="configuration"> 
     <xs:complexType>
      <xs:sequence>
          <xs:element name="applicationSettings" type="applicationSettingsType" nillable="false" />
      </xs:sequence>
     </xs:complexType>
 </xs:element>
 
  <xs:simpleType name="enumEnableDisable">
    <xs:annotation>
      <xs:documentation>
        Enumeration type with expected single choice of either
        Enable or Disable.
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:enumeration value="Enable"></xs:enumeration>
      <xs:enumeration value="Disable"></xs:enumeration>
      <xs:whiteSpace value="collapse"></xs:whiteSpace>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="enumAllExcludeInclude">
    <xs:annotation>
      <xs:documentation>
        Enumeration type with expected single choice of either
        All, Include, or Exclude.
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:enumeration value="All"><!--Allow all extensions--></xs:enumeration>
      <xs:enumeration value="Exclude all extensions in set"><!--comment--></xs:enumeration>
      <xs:enumeration value="Include all extensions in set"><!--comment--></xs:enumeration>
      <xs:whiteSpace value="collapse"></xs:whiteSpace>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="patternBingAppID">
        <xs:annotation>
          <xs:documentation>Bing App ID acquired from Bing.com's Developer site.</xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:string">
      <xs:pattern value="[0-9A-Z]{40}"></xs:pattern>
      <xs:whiteSpace value="collapse"></xs:whiteSpace>
      <xs:length value="40"></xs:length>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="patternIsoLanguageCountry">
    <xs:restriction base="xs:string">
      <xs:pattern value="[a-z]{2}\-[A-Z]{2}"></xs:pattern>
      <xs:whiteSpace value="collapse"></xs:whiteSpace>
      <xs:length value="5"></xs:length>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="patternDomainName">
    <xs:annotation>
      <xs:documentation>Web domain address.</xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:pattern
        value="([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,6}">
      </xs:pattern>
      <xs:whiteSpace value="collapse"></xs:whiteSpace>
    </xs:restriction>
  </xs:simpleType>

  <xs:complexType name="domainArrayType">
    <xs:annotation>
      <xs:documentation>This is a representation of an array of Web domain addresses.</xs:documentation>
    </xs:annotation>
    <xs:sequence minOccurs="0" maxOccurs="unbounded">
      <xs:element name="domain" type="patternDomainName" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
  </xs:complexType>

  <xs:simpleType name="patternUrlPath">
    <xs:restriction base="xs:string">
      <xs:pattern
        value="(/[a-zA-Z0-9_\-\+]+)*">
      </xs:pattern>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="nillable">   
    <xs:restriction base="xs:string">   
      <xs:enumeration value="" />   
    </xs:restriction>   
  </xs:simpleType>  

  <xs:simpleType name="integerReal">
    <xs:restriction base="xs:integer">
      <xs:minInclusive value="0"></xs:minInclusive>
    </xs:restriction>
  </xs:simpleType>  
  
  <xs:simpleType name="integerRealNillable">
    <xs:union memberTypes="integerReal nillable" />
  </xs:simpleType>
  
  <xs:simpleType name="integerBingWebCount">
    <xs:restriction base="integerReal">
      <xs:minInclusive value="1"></xs:minInclusive>
      <xs:maxInclusive value="50"></xs:maxInclusive>
    </xs:restriction>
  </xs:simpleType>
</xs:schema>